import re
re.sub()


lines=[]
with open('图像基本操作.md','r',encoding='utf-8') as f:
    lines=f.readlines()

    
for line in lines:
    print(line)


def changeOutFilename(temstr):
    def fun(tem):
        tem=str(tem.group())
        return 'images_图像基本操作/output/{}'.format(tem)
    
    res=re.sub('output\w+.png',fun,temstr)
    return res


def changeImageFilename(temstr):
    def fun(tem):
        filename=tem.group(2)
        return 'images_图像基本操作/{}'.format(filename)

    res=re.sub('(images)/(\w+.\w{3,3})',fun,temstr)
    return res


for index,line in enumerate(lines):
    lines[index]=changeOutFilename(line)
    # lines[index]=changeImageFilename(line)


for index,line in enumerate(lines):
    print(line)


with open('图像基本操作2.md','w',encoding='utf-8') as f:
    f.writelines(lines)



